package mysql

import "gorm.io/gorm"

type User struct { //用户表
	gorm.Model
	Mobile   string `gorm:"type:char(11);not null;"`     //电话
	Password string `gorm:"type:char(32);not null;"`     //密码
	Image    string `gorm:"type:varchar(500);not null;"` //头像
	Name     string `gorm:"type:varchar(20);not null;"`  //名字
}

type Book struct { //商品表
	gorm.Model
	Name    string `gorm:"type:varchar(20);not null;"`  //标题
	Title   string `gorm:"type:varchar(20);not null;"`  //分类
	Price   int64  `gorm:"type:int(11);not null;"`      //价格
	Tab     string `gorm:"type:varchar(200);not null;"` //描述
	UserId  int64  `gorm:"type:int(11);not null;"`      //用户ID
	ClassId int64  `gorm:"type:int(11);not null;"`      //分类ID
}

type Class struct { // 分类表
	gorm.Model
	UserId int64  `gorm:"type:int(11);not null;"`
	Name   string `gorm:"type:varchar(20);not null;"`
}

type Comment struct { //收藏表
	gorm.Model
	UserId int64 `gorm:"type:int(11);not null;"`
	BookId int64 `gorm:"type:int(11);not null;"`
}

type PingLun struct { //评论表
	gorm.Model
	BookId int64  `gorm:"type:int(11);not null;"`
	Name   string `gorm:"type:varchar(20);not null;"`
}

type UserBookClass struct {
	Book
	UserName  string
	Classname string
}

type CommentData struct {
	Comment
	UserId int64
	BookId int64
}

type BookPingLun struct {
	PingLun
	BookId int64
}
